<template>
  <div class="app-main">
    <div class="section-main clearfix">
      <div class="sleft">
          <div  class="cutimg">
            <div  class="img-div">
              <img :src="imgUrl" alt="">
            </div>
          </div>
          <div class="title">
            <p>师恩似海/感怀师恩</p>
            <p>感恩教师节</p>
          </div>
          <p class="content" v-text="content"></p>
        </div>
        <div class="sright">
          <div class="img-thanks">
               <img src="../../../assets/img/jiaoshi/thanks.png" alt="">
          </div>

        </div>
    </div>
    <div class="section-bottom">
      <img src="../../../assets/img/jiaoshi/book.png" alt="" class="img-fenche">
        <div class="show-div" @click="suremake">
          <btn-router
            backgroundColor='#338557'
            :width=256
            :height=50
            size='14'
          >生成贺卡</btn-router>
        </div>
        <div class="back-div" @click="goback" >
          <btn-router
            backgroundColor='#338557'
            :width=256
            :height=50
            size='14'
          >返回上级</btn-router>
        </div>
    </div>
  </div>
</template>

<script>
import btnRouter from '@/components/routerButton'// 跳转按钮组件
import { mapState } from 'vuex'

console.log(mapState)
export default {
  name: 'Show',
  data () {
    return {
    }
  },
  computed: {
    ...mapState({
      imgUrl: state => state.file.imgUrl,
      content: state => state.file.content
    })
  },
  components: {
    btnRouter
  },
  methods: {

    goback () {
      this.$router.go(-1)
    },
    suremake () {
      if (this.imgUrl) {
        var imgfile = this.convertBase64UrlToBlob(this.imgUrl)
        console.log(imgfile)
      }
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .app-main{background:url(../../../assets/img/jiaoshi/background.png) no-repeat top left;background-size:cover}
  .app-main::before{z-index:3;margin: 0.5% 1%;box-sizing: border-box;content: '';width: 98%;height: 99%;background:url(../../../assets/img/jiaoshi/background1.png) no-repeat center center;background-size:98% 99%;position: absolute}
  .section-main{position:relative;top:1rem;margin: 0 auto;width:100%;padding:5%;z-index: 4}
  .content{width:100%;overflow: hidden;;padding:5%;font-size:12px;word-break:break-all;line-height: 2em;}

  .title{width:100%;position: relative;font-size: 16px;text-align: justify;text-align-last: justify;font-weight: 700}

  .sleft{position: relative;float: left;width: 4rem;top:-0.3rem;}
  .sright{float: right;width:4rem;position: absolute;right: 4%;top:0.1rem}
  .sright img{width: 100%}
  .cutimg{margin: 10px auto 20px;position: relative;width:2rem;height:2rem;border: 5px solid #000;box-sizing: border-box}
  .img-div{width:100%;height:100%;overflow: hidden;}
  .cutimg img{width:100%;}
  .section-bottom{position:absolute;bottom:0;width:100%}
  .section-bottom img{position:absolute;bottom:0;width:100%;z-index:2}
  .show-div{position:relative;bottom:.2rem;left:1rem;display:inline-block;z-index:5}
  .back-div{position:relative;right:1rem;bottom:.2rem;float:right;display:block;z-index:5}
</style>
